<template>
  <div>
    <el-menu
      :default-active="activeIndex"
      class="el-menu-demo"
      mode="horizontal"
      @select="handleSelect"
    >
      <el-submenu style="float: right" index="2">
        <template slot="title">{{ userName }}</template>
        <el-menu-item index="2-1">选项1</el-menu-item>
        <el-menu-item index="2-2">选项2</el-menu-item>
        <el-menu-item @click="signout" index="/signout">退出登录</el-menu-item>

      </el-submenu>
    </el-menu>
  </div>
</template>

<script>
export default {
  name: "AdminNavbar",
  props: ["userName"],
  data() {
    return {
      activeIndex: ""
    };
  },
  watch: {},

  methods: {
    handleSelect() {},
      signout(){
        this.$router.push({
            name:'Login'
        })
      }
  }
};
</script>

<style scoped></style>
